package com.LoginTest;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/ys")
public class YesServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //设置请求乱码
        req.setCharacterEncoding("utf-8");
        //设置响应乱码
        resp.setContentType("text/html;charset=utf-8");

        //获取存入的用户名
        Object name = req.getAttribute("name");
        resp.getWriter().write("欢迎登录,"+name+"!");
    }
}
